package com.example.demo.controller;

import com.example.demo.domain.Order;
import com.example.demo.feign.OrderServiceClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by fandg on 2020/4/1.
 */
@RestController
@RequestMapping("user")
public class UserController {

    private static final Logger logger = LoggerFactory.getLogger(UserController.class);

    @Autowired
    public OrderServiceClient orderServiceClient;

    @RequestMapping("/list")
    public List<Order> list() {
        logger.info("调用user-service02 的列表查询接口");
        return orderServiceClient.orderList();
    }

    @RequestMapping("/one")
    public Order one(Long id) {
        logger.info("调用user-service02 的单条查询接口");
        return orderServiceClient.getOrder(id);
    }
}
